package org.adream.account.service;

import org.adream.account.dao.OAuthMemoryDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @author sl
 */
@Service
public class OAuthMemoryService {
	
	@Autowired
	private OAuthMemoryDao oAuthMemoryDao;
	
	/**
	 * 定时任务:每10分钟删除前5分钟过期的登录缓存数据
	 */
	@Scheduled(cron = "0 */10 * * * ?")
	public void deleteExpiredOAuthMemory() {
		long expire = System.currentTimeMillis() / 1000 - 5 * 60;
		oAuthMemoryDao.deleteOAuthMemoryltExpire(expire);
	}
}